#ifndef CSPARAMSHOWDIALOG_H
#define CSPARAMSHOWDIALOG_H

#include <QDialog>
#include "common.h"
#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
#include <QTableWidget>
#include <QDialogButtonBox>

class T2CManager;

struct CinnectionInfo
{
    T2CManager * man;
    QString host;
    QString port;
};


class AssignCSParamDialog : private QDialog
{
    Q_OBJECT

    T2CManager * man;
    QString host;
    int port;
    QStringList paramsToTag;

    QGridLayout      * glay;
    QGroupBox        * gbConnection;
    QGridLayout      * glayConnection;
    QLabel           * lblIP;
    QLineEdit        * leIP;
    QLabel           * lblPort;
    QLineEdit        * lePort;
    QPushButton      * btnConnectCS;
    QPushButton      * btnDisconnect;
    QGroupBox        * gbParamersTable;
    QGridLayout      * glaylTableParam;
    QLabel           * lblIDF;
    QLineEdit        * leIDF;
    QPushButton      * btnGetParam;
    QTableWidget     * twParams;
    QWidget          * wgtDummy;
    QDialogButtonBox * buttonBox;
    
public:
    explicit AssignCSParamDialog( CinnectionInfo * ci, QWidget *parent = 0 );
    ~AssignCSParamDialog();

    int Exec();
    QStringList GetIdfList() { return paramsToTag; }
    
private:
    void setEnabledControls( bool disconnected );
    void prepareTable();
    void setRowsHeight( int h = TABLE_ROW_HEIGHT );

    void enableControls();
    void disableControls();

private slots:
    void sltConnect();
    void sltDisconnect();
    void sltGetParamList();
    void sltReceiveCSRespose( QString txt );
    void sltT2CManConnectoinChanged();
    //void sltExecCmdList( QStringList cmd );
    //void sltReceivePV( quint64 idf );

signals:
    //void sgnExecCmdList( QStringList cmd );
};

#endif // CSPARAMSHOWDIALOG_H
